Skip to content

docs: update memory leak debugging skill#2330

Open
mturac wants to merge 1 commit into
ChromeDevTools:mainfrom
mturac:izon/update-memory-leak-skill
Open

docs: update memory leak debugging skill#2330
mturac wants to merge 1 commit into
ChromeDevTools:mainfrom
mturac:izon/update-memory-leak-skill

Conversation

@mturac

@mturac mturac commented Jul 9, 2026

Copy link
Copy Markdown

Summary

  • Update the memory leak debugging skill to prefer the built-in heap snapshot tools.
  • Add guidance for comparing snapshots, inspecting retainers, and closing loaded snapshots.
  • Keep memlab and the fallback comparison script as external fallback paths.

Issue #2329.

Validation

  • git diff --check origin/main...HEAD
  • npm run check-format

@mturac mturac force-pushed the izon/update-memory-leak-skill branch 8 times, most recently from 237b7f7 to 709080a Compare July 9, 2026 14:33
@Lightning00Blade Lightning00Blade self-requested a review July 9, 2026 14:41
@mturac

mturac commented Jul 9, 2026

Copy link
Copy Markdown
Author

Validation refreshed on the current head 709080ad39547376e8ac1bffe6f95dbdb042c060.

Local validation:

git diff --check origin/main...HEAD
npm run check-format
npm run build

All pass locally. The current GitHub checks are also green across the visible Node 22/24/26 test matrix on macOS, Ubuntu, and Windows, plus the required format, docs, title, check-changes, and CLA checks.

@mturac mturac force-pushed the izon/update-memory-leak-skill branch from 709080a to d36463d Compare July 9, 2026 23:45
@mturac

mturac commented Jul 9, 2026

Copy link
Copy Markdown
Author

Rebased this branch onto the current main in d36463da312f.

Validation on the rebased head:

git diff --check origin/main...HEAD
npm run check-format
npm run test -- --test-concurrency=1 --retry

All pass locally.

@mturac mturac force-pushed the izon/update-memory-leak-skill branch from d36463d to 7d67c47 Compare July 10, 2026 08:05

@Lightning00Blade Lightning00Blade left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
FYI changed the closes to issue, so we keep it open while we do other changes as well.

- **Prefer MCP memory tools:** Do NOT attempt to read raw `.heapsnapshot` files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
- **Isolate the Leak:** Determine if the leak is in the browser (client-side) or Node.js (server-side).
- **Common Culprits:** Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. _Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them._
- **Close Loaded Snapshots:** Heap snapshots can be large. Use `close_heapsnapshot` after inspecting a file to release memory held by the MCP server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Close Loaded Snapshots:** Heap snapshots can be large. Use `close_heapsnapshot` after inspecting a file to release memory held by the MCP server.
- **Close Loaded Snapshots:** After completing you full investigation use `close_heapsnapshot` to free up memory on the MCP server.

I think this may be a little bit better as the first one can be interpreted as release after every tool call, which will effectively re-parse a heapsnapshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants